Public Overloads Function Delete(Of T As {Class, New})( _ ByVal primaryKey As Long _ ) As Integer
Dim instance As NinjaDbPro Dim primaryKey As Long Dim value As Integer value = instance.Delete(Of T)(primaryKey)
public int Delete<T>( long primaryKey ) where T: class, new()
public: int Deletegeneric<typename T> ( int64 primaryKey ) where T: ref class, gcnew()
NinjaDbPro db = new NinjaDbPro("MyDatabaseDirectory", "MyDatabaseName"); //Licensed Mode //db.UserName = "John Smith 101224"; //db.LicenseKey = "aousdf832jasf=="; //Set before OpenDatabase. Default storage is IsolatedStorageDatabase. Other options are: //db.Storage = new MemoryDatabase(); //In memory database //db.Storage = new FileDatabase(); List<long> keys = new List<long>(); db.OpenDatabase(); for (int i = 0; i < 1000; i++) { keys.Add(i + 1); Vendor vendor = new Vendor(); vendor.Name = "Vendor " + i; db.Save(vendor); } //Do a bulk delete int recordsDeleted = db.Delete<Vendor>(keys.ToArray()); //This will load no records since they were all deleted List<Vendor> vendors = db.LoadAll<Vendor>(); db.CloseDatabase();
Dim db As New NinjaDbPro("MyDatabaseDirectory", "MyDatabaseName") 'Licensed Mode 'db.UserName = "John Smith 101224"; 'db.LicenseKey = "aousdf832jasf=="; 'Set before OpenDatabase. Default storage is IsolatedStorageDatabase. Other options are: 'db.Storage = new MemoryDatabase(); //In memory database 'db.Storage = new FileDatabase(); Dim keys As New List(Of Long)() db.OpenDatabase() For i As Integer = 0 To 999 keys.Add(i + 1) Dim vendor As New Vendor() vendor.Name = "Vendor " & i db.Save(vendor) Next i 'Do a bulk delete Dim recordsDeleted As Integer = db.Delete(Of Vendor)(keys.ToArray()) 'This will load no records since they were all deleted Dim vendors As List(Of Vendor) = db.LoadAll(Of Vendor)() db.CloseDatabase()
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2